<%-- 
 *  File:    CheckSession.jsp
 *  @Author: Kicar Xu
 *  Date:    2002/04/02
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page language="java" %>   
<%@ page import="javax.servlet.*, javax.servlet.jsp.*" %>
<%@ page import="java.util.*,org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<html>
 <head>
<script language="JavaScript">
<%  
	String strSessionLanguageCode = (String)request.getParameter("languagecode");
  	if(strSessionLanguageCode == null)
  	{
    	strSessionLanguageCode = (String)session.getAttribute("languagecode");
  	  if(strSessionLanguageCode == null)
    	  strSessionLanguageCode = "cn";
   	} 
  	session.setAttribute("languagecode",strSessionLanguageCode);
  	boolean stoFlag = false;
  	if(session.getAttribute("errorcode")!=null)
  	{
  		Vector em = (Vector)session.getAttribute("errorcode");
  		for(int j=0;j<em.size();j++)
  		{
  			HashMap hm = (HashMap)em.elementAt(j);
  			if(hm!=null && "SESSION_TIMEOUT".equals((String)hm.get("messagecode")))
  				stoFlag = true;	
  		}
  	}
  	if(session.isNew() || stoFlag)
	{
		Vector errs = new Vector();
		HashMap errMessage = new HashMap();
		errMessage.put("messagecode", "SESSION_TIMEOUT"); 
		errs.addElement(errMessage);
		session.setAttribute("errorcode", errs);
		//response.sendRedirect( ConstantProp.DEFAULT_ROOT_PATH + "/HomePage.jsp?languagecode=" + strSessionLanguageCode);  
		//return;  
%>
   self.location.href = "<%= ConstantProp.DEFAULT_ROOT_PATH %>/HomePage.jsp?<%= OvalTools.randomURL() %>&languagecode=<%=JspHelper.filterNull( strSessionLanguageCode )%>";
<%	
	} else {
	    if(pageContext != null && pageContext.getServletContext() != null)
      {
        RequestDispatcher dispatcher = pageContext.getServletContext().getNamedDispatcher("Dispatcher");
	      //System.out.println("this starts the dispatch" + dispatcher);  
	      if(dispatcher != null)  
	       dispatcher.forward(request, response);
	    }
		// response.sendRedirect( ConstantProp.DEFAULT_ROOT_PATH + "/HomePage.jsp?languagecode=" + strSessionLanguageCode);  
		//  return; 
%>
   self.location.href = "<%= ConstantProp.DEFAULT_ROOT_PATH %>/HomePage.jsp?<%= OvalTools.randomURL() %>&languagecode=<%=JspHelper.filterNull( strSessionLanguageCode )%>";
<%
	}
%>
</script>  	
 </head>
<body>

</body>
</html>

